package com.jjwxc.jwjskandriod.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.jjwxc.jwjskandriod.fragment.MainBgFragment;
import com.jjwxc.jwjskandriod.fragment.ReadBgFragment;
import com.jjwxc.jwjskandriod.fragment.VipInfoFragment;
import com.jjwxc.jwjskandriod.widget.AutoHeightViewPager;

public class MyAdapter extends FragmentPagerAdapter {
    AutoHeightViewPager viewPager;

    public MyAdapter(FragmentManager fm, AutoHeightViewPager viewPager) {
        super(fm);
        this.viewPager = viewPager;
    }

    @Override
    public Fragment getItem(int i) {
        Fragment fragment = null;
        switch (i) {
            case 0:
                fragment = new VipInfoFragment(viewPager);
                break;
            case 1:
                fragment = new MainBgFragment(viewPager);
                break;
            case 2:
                fragment = new ReadBgFragment(viewPager);
                break;
            default:
                break;
        }
        return fragment;
    }

    @Override
    public int getCount() {
        return 3;
    }

}

